Intra prediction method and apparatus

ABSTRACT

An intra prediction method according to the present invention comprises the following steps: performing a directional prediction using at least one of a neighboring pixel of a current block and a left upper corner pixel positioned at a left upper corner of the current block so as to obtain a first prediction value for the current block; obtaining a second prediction value for the current block using the reference sample positioned in the current block; and weighted summing the first prediction value and the second prediction value using a weighting matrix so as to obtain a final prediction value for the current block. According to the present invention, image encoding/decoding efficiency may be improved.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a Continuation Application of U.S. application Ser.No. 13/991,279 filed on Jun. 3, 2013, now U.S. Pat. No. 9,462,272 issuedOct. 4, 2016, which is a National Stage of International Application No.PCT/KR2011/009599, filed Dec. 13, 2011 and published as WO 2012/081895A1 on Jun. 21, 2012, which claims the benefit under 35 U.S.C. § 119 ofKorean Patent Application No. 10-2010-0126775 filed Dec. 13, 2010 andKorean Patent Application No. 10-2011-0133708 filed Dec. 13, 2011, theentire disclosures of which are incorporated herein by reference for allpurposes.

TECHNICAL FIELD

The present invention relates to image processing, and moreparticularly, to an intra prediction method and apparatus.

BACKGROUND ART

Recently, with the expansion of broadcasting services having highdefinition (HD) resolution in the country and around the world, manyusers have been accustomed to a high resolution and definition image,such that many organizations have conducted many attempts to developnext-generation video devices. In addition, the interest in HDTV andultra high definition (UHD) having a resolution four times higher thanthat of HDTV have increased and thus, a compression technology forhigher-resolution and higher-definition image have been required.

For the image compression, an inter prediction technology predictingsample values included in a current picture from a picture before and/orafter the current picture, an intra prediction technology predictingsample values included in a current picture using sample information inthe current picture, an entropy encoding technology allocating a shortcode to symbols having a high appearance frequency and a long code tosymbols having a low appearance frequency, or the like, may be used.

DISCLOSURE Technical Problem

The present invention provides video encoding method and apparatuscapable of improving video encoding/decoding efficiency.

Further, the present invention provides video decoding method andapparatus capable of improving video encoding/decoding efficiency.

In addition, the present invention provides intra prediction method andapparatus capable of improving video encoding/decoding efficiency.

Technical Solution

In an aspect, there is provided an intra prediction method, including:deriving a first prediction value for the current block by performingdirectional prediction using at least one of neighboring samplesadjacent to a current block and left upper corner samples at a leftupper corner of the current block; deriving a second prediction valuefor the current block by using a reference sample positioned in thecurrent block; and deriving a final prediction value for the currentblock by performing a weighting sum for the first prediction value andthe second prediction value using a weighting matrix.

The deriving of the second prediction value may further include:positioning the reference sample; reconstructing the reference sample ofthe determined position; and deriving the second prediction value usingthe reconstructed reference sample.

The positioning of the reference sample may determine a predeterminedfixed position as the position of the reference sample.

The positioning of the reference sample may further include: receivingposition information on the position of the reference sample from anencoder; decoding the position information; and positioning thereference sample using the decoded position information.

The positioning of the reference sample may determine the referencesample using neighboring block information included in the reconstructedneighboring blocks, the reconstructed neighboring blocks being blocksadjacent to the current block and the neighboring block informationbeing at least one of partition information, prediction directioninformation, and quantization parameter information of the reconstructedneighboring blocks.

The positioning of the reference sample may determine the referencesample using information on spatial variations of the neighboringsamples adjacent to the current block.

The reconstructing of the reference sample may further include:receiving and decoding a residual signal for the reference sample froman encoder; deriving a third prediction value for the reference sample;and deriving a value of the reference sample by adding the decodedresidual signal to the third prediction value.

The deriving of the third prediction value may include: deriving thethird prediction value using at least one of the neighboring samples,the left upper corner samples, and the previously reconstructedreference sample.

At the deriving of the second prediction value, the second predictionvalue may be derived as the same value as the sample value of thereconstructed reference sample.

At the deriving of the second prediction value, the second predictionvalue may be derived by a weighting sum of a sample value of thereconstructed reference sample and a sample value of the neighboringsample.

When the number of reference samples is two or more, the deriving of thesecond prediction value may further include: separating the currentblock into a plurality of regions each including one reference sample;and deriving the sample value of the reference sample existing in thecurrent region among the plurality of separated regions as the secondprediction value for the current region.

The weighting matrix may be determined based on a size of the currentblock or a prediction direction for the current block.

The weighting matrix may be a predetermined fixed weighting matrix.

The deriving of the final prediction value may include: adaptivelyupdating the weighting matrix; and performing a weighting sum of thefirst prediction value and the second prediction value by using theupdated weighting matrix.

Advantageous Effects

The video encoding method according to the exemplary embodiments of thepresent invention can improve the video encoding/decoding efficiency.

Further, the video decoding method according to the exemplaryembodiments of the present invention can improve the videoencoding/decoding efficiency.

The intra prediction method according to the exemplary embodiments ofthe present invention can improve the video encoding/decodingefficiency.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram showing a configuration of an video encodingapparatus to according to an exemplary embodiment of the presentinvention.

FIG. 2 is a block diagram showing a configuration of an video decodingapparatus to according to an exemplary embodiment of the presentinvention.

FIG. 3 is a flow chart schematically showing an intra prediction methodin an encoder according to an exemplary embodiment of the presentinvention.

FIG. 4 is a conceptual diagram schematically showing a method forderiving a first prediction value according to an exemplary embodimentof the present invention.

FIG. 5 is a flow chart schematically showing a method for deriving asecond prediction value in the encoder according to an exemplaryembodiment of the present invention.

FIG. 6 is a conceptual diagram schematically showing a method forpositioning a reference sample according to an exemplary embodiment ofthe present invention.

FIG. 7 is a conceptual diagram schematically showing a method forpositioning a reference sample according to another exemplary embodimentof the present invention.

FIG. 8 is a conceptual diagram schematically showing a method forencoding a reference sample position according to an exemplaryembodiment of the present invention.

FIG. 9 is a conceptual diagram schematically showing a method fordetermining a reference sample value according to an exemplaryembodiment of the present invention.

FIG. 10 is a conceptual diagram for explaining a method for encoding areference sample according to the exemplary embodiment of the presentinvention.

FIG. 11 is a conceptual diagram schematically showing a method forderiving a second prediction value for a current block using areconstructed reference sample according to the exemplary embodiment ofthe present invention.

FIG. 12 is a conceptual diagram schematically showing a weighting matrixaccording to the exemplary embodiment of the present invention.

FIG. 13 is a flow chart schematically showing an intra prediction methodin a decoder according to an exemplary embodiment of the presentinvention.

FIG. 14 is a flow chart schematically showing a method for deriving asecond prediction value in the decoder according to an exemplaryembodiment of the present invention.

MODE FOR INVENTION

Hereinafter, exemplary embodiments of the present invention will bedescribed in detail with reference to the accompanying drawings. Indescribing exemplary embodiments of the present invention, well-knownfunctions or constructions will not be described in detail since theymay unnecessarily obscure the understanding of the present invention.

It will be understood that when an element is simply referred to asbeing ‘connected to’ or ‘coupled to’ another element without being‘directly connected to’ or ‘directly coupled to’ another element in thepresent description, it may be ‘directly connected to’ or ‘directlycoupled to’ another element or be connected to or coupled to anotherelement, having the other element intervening therebetween. Further, inthe present invention, “comprising” a specific configuration will beunderstood that additional configuration may also be included in theembodiments or the scope of the technical idea of the present invention.

Terms used in the specification, ‘first’, ‘second’, etc. can be used todescribe various components, but the components are not to be construedas being limited to the terms. The terms are only used to differentiateone component from other components. For example, the ‘first’ componentmay be named the ‘second’ component without being departed from thescope of the present invention and the ‘second’ component may also besimilarly named the ‘first’ component.

Furthermore, constitutional parts shown in the embodiments of thepresent invention are independently shown so as to representcharacteristic functions different from each other. Thus, it does notmean that each constitutional part is constituted in a constitutionalunit of separated hardware or software. In other words, eachconstitutional part includes each of enumerated constitutional parts forconvenience. Thus, at least two constitutional parts of eachconstitutional part may be combined to form one constitutional part orone constitutional part may be divided into a plurality ofconstitutional parts to perform each function. The embodiment where eachconstitutional part is combined and the embodiment where oneconstitutional part is divided are also included in the scope of thepresent invention, if not departing from the essence of the presentinvention.

In addition, some of constituents may not be indispensable constituentsperforming essential functions of the present invention but be selectiveconstituents improving only performance thereof. The present inventionmay be implemented by including only the indispensable constitutionalparts for implementing the essence of the present invention except theconstituents used in improving performance The structure including onlythe indispensable constituents except the selective constituents used inimproving only performance is also included in the scope of the presentinvention.

FIG. 1 is a block diagram showing a configuration of a video encodingapparatus to according to an exemplary embodiment of the presentinvention.

Referring to FIG. 1, a video encoding apparatus 100 includes a motionestimator 111, a motion compensator 112, an intra predictor 120, aswitch 115, a subtractor 125, a transformer 130, a quantizer 140, anentropy encoder 150, a dequantizer 160, an inverse transformer 170, anadder 175, a filter unit 180, and a reference picture buffer 190.

The video encoding apparatus 100 may perform encoding on input imageswith an intra mode or an inter mode to output bitstreams. The intraprediction means intra-picture prediction and the inter prediction meansinter-picture prediction. In the case of the intra mode, the switch 115may be switched to intra and in the case of the inter mode, the switch115 may be switched to inter. The video encoding apparatus 100 maygenerate a prediction block for an input block of the input images andthen, encode residuals between the input block and the prediction block.

In the case of the intra mode, the intra predictor 120 may performspatial prediction using the sample values of the previously encodedblocks around the current block to generate the prediction block.

In the case of the inter mode, the motion estimator 111 may obtain amotion vector by searching a region optimally matched with the inputblock in a reference picture stored in the reference picture buffer 190during a motion prediction process. The motion compensator 112 mayperform the motion compensation by using the motion vector to generatethe prediction block.

The subtractor 125 may generate a residual block due to the residuals ofthe input block and the generated prediction block. The transformer 130may output transform coefficients by performing a transform on theresidual block. Further, the quantizer 140 may quantize the inputtransform coefficient according to quantization parameters to outputquantized coefficients.

The entropy encoder 150 may perform entropy encoding based on valuescalculated in the quantizer 140 or encoding parameter values, or thelike, calculated during the encoding process to output bitstreams.

When the entropy encoding is applied, the entropy encoding may representsymbols by allocating a small number of bits to the symbols having highoccurrence probability and allocating a large number of bits to thesymbols having low occurrence probability to reduce a size of thebitstreams for the symbols to be encoded. Therefore, the compressionperformance of the video encoding may be increased through the entropyencoding. For the entropy encoding, an encoding method such asexponential golomb, context-adaptive variable length coding (CAVLC),context-adaptive binary arithmetic coding (CABAC), or the like, may beused.

The video encoding apparatus according to the exemplary embodiment ofFIG. 1 performs the inter prediction encoding, that is, theinter-picture prediction encoding and thus, the current encoded pictureneeds to be decoded and stored so as to be used as the referencepicture. Therefore, the quantized coefficient may be dequantized in thedequantizer 160 and inversely transformed in the inverse transformer160. The dequantized, inverse transformed coefficients are added to theprediction block through the adder 175 and a reconstructed block isgenerated.

The reconstructed block passes through the filter unit 180 and thefilter unit 180 may apply at least one of a deblocking filter, sampleadaptive offset (SAO), and an adaptive loop filter to the reconstructedblock or a reconstructed picture. The filter unit 180 may be referred toas an adaptive in-loop filter (ALF). The deblocking filter may remove ablock distortion generated at a boundary between the blocks. The SAO mayadd a proper offset value to the sample values so as to compensate forcoding error. The ALF may perform the filtering based on a valueobtained by comparing the reconstructed picture with an original pictureand may be also performed only when the high efficiency is applied. Thereconstructed block passing through the filter unit 180 may be stored inthe reference picture buffer 190.

FIG. 2 is a block diagram showing a configuration of a video decodingapparatus to according to an exemplary embodiment of the presentinvention.

Referring to FIG. 2, a video decoding apparatus 200 includes an entropydecoder 210, a dequantizer 220, an inverse transformer 230, an intrapredictor 240, a motion compensator 250, an adder 255, a filter unit260, and a reference picture buffer 270.

The video decoding apparatus 200 may receive the bitstreams output fromthe encoder to perform the decoding with the intra mode or the intermode and output the reconstructed image, that is, the reconstructedimage. In the case of the intra mode, the switch may be switched to theintra and in the case of the inter mode, the switch may be switched tothe inter mode. The video decoding apparatus 200 obtains the residualblock from the received bitstreams and generates the prediction blockand then, add the residual block and the prediction block, therebygenerating the reconstructed block, that is, the reconstructed block.

The entropy decoder 210 may perform the entropy encoding on the inputbitstreams according to the probability distribution to generate thesymbols having the quantized coefficient type of symbols. The entropydecoding method is similar to the above-mentioned entropy encodingmethod.

When the entropy decoding method is applied, a small number of bits areallocated to the symbols having high occurrence probability and a largenumber of bits are allocated to the symbols having low occurrenceprobability to represent the symbols, thereby reducing a size of thebitstreams for each symbol. Therefore, the compression performance ofthe video decoding may also be increased through the entropy decodingmethod.

The quantized coefficients are dequantized in the dequantizer 220 andare inversely transformed in the inverse transformer 230. The quantizedcoefficients may be dequantized/inversely transformed to generate theresidual block.

In the case of the intra mode, the intra predictor 240 may performspatial prediction using the sample values of the previously encodedblocks around the current block to generate the prediction block. In thecase of the inter mode, the motion compensator 250 performs the motioncompensation by using the motion vector and the reference picture storedin the reference picture buffer 270, thereby generating the predictionblock.

The residual block and the prediction block are added through the adder255 and the added block passes through the filter unit 260. The filterunit 260 may apply at least one of the deblocking filter, the SAO, andthe ALF to the reconstructed block or the reconstructed picture. Thefilter unit 260 outputs the reconstructed images, that is, thereconstructed images. The reconstructed image may be stored in thereference picture buffer 270 so as to be used for the inter prediction.

Hereinafter, the block means a unit of the image encoding and decoding.At the time of the image encoding and decoding, the coding or decodermeans the divided unit when performing the encoding and decoding bydividing the pictures, which may be called a coding unit (CU), a codingblock (CB), a prediction unit (PU), a prediction block (PB), a transformunit (TU), a transform block (TB), or the like. The single block may besubdivided into a lower block having a smaller size. In addition, in theexemplary embodiments to be described below, the current block may meanthe block to be encoded and/or the current block to be decoded.

In addition, the blocks adjacent to the current block may be referred toas the neighboring block, the blocks adjacent to the upper end of thecurrent block may be referred to as the upper neighboring block, and theblocks adjacent to the left of the current block may be referred to asthe left neighboring block. Further, the samples adjacent to the currentblocks may be referred to as the neighboring samples, the samplesadjacent to the upper end of the current block may be referred to as theupper neighboring samples, and the samples adjacent to the left of thecurrent block may be referred to as the left neighboring samples.

Meanwhile, the intra prediction may be performed using the reconstructedneighboring samples adjacent to the current block. In this case, thedirectional prediction may be used. When the intra prediction isperformed in each prediction mode using the directional prediction, asthe samples are far away from the reconstructed neighboring samplesamong the samples in the current block, the samples may have largeprediction errors. The prediction error may also affect the blocksencoded after the current block and may cause the degradation in imagequality and the degradation in the coding efficiency.

Therefore, in order to reduce the prediction errors increased as thedistance from the reconstructed neighboring samples is increased; theintra prediction method and apparatus using the reference sample withinthe current block may be provided.

FIG. 3 is a flow chart schematically showing an intra prediction methodin an encoder according to an exemplary embodiment of the presentinvention. Hereinafter, a first prediction value may mean a predictionvalue derived using only the reconstructed neighboring sample and asecond prediction value may mean the prediction value derived using thereconstructed neighboring samples and the reference sample within thecurrent block together.

Referring to FIG. 3, the encoder may derive the first prediction valuefor the current block (S310).

The encoder may derive the first prediction value using the samplevalues of the reconstructed neighboring samples. In this case, the usedintra prediction method may be the directional prediction and/or thenon-directional prediction. The prediction direction used for thedirectional prediction may be a vertical direction, a horizontaldirection, a diagonal direction, or the like. The detailed exemplaryembodiment of the method for deriving the first prediction value will bedescribed below.

Referring again to FIG. 3, the encoder may use the reference samplewithin the current block to derive the second prediction value (S320).

The encoder may determine at least one reference sample within thecurrent block and perform the intra prediction based on the determinedreference sample to derive the second prediction value. The detailedexemplary embodiment of the method for deriving the second predictionvalue will be described below.

Herein, the process of deriving the first prediction value and theprocess of deriving the second prediction value may be performed insequence different from the above-mentioned description orsimultaneously. For example, the encoder may derive the secondprediction value earlier than the first prediction value and the processof deriving the first prediction value and the process of deriving thesecond prediction value may be simultaneously performed.

When the first prediction value and the second prediction value arederived, the encoder may derive the final prediction value using thefirst prediction value and the second prediction value (S330). In thiscase, the encoder may derive the final prediction value for the sampleswithin the current block by the weighting sum of the first predictionvalue and the second prediction value. The detailed exemplary embodimentof the method for deriving the final prediction value using theweighting value will be described below.

FIG. 4 is a conceptual diagram schematically showing a method forderiving a first prediction value according to an exemplary embodimentof the present invention. A size of the current block subjected to theintra prediction may be 4×4, 8×8, 16×16, 32×32, 64×64, and 128×128. FIG.4 shows the embodiment of the case in which the size of the currentblock is 8×8. (x, y) represented in the current block means thecoordinates of the sample within the current block.

A to Y represent the reconstructed neighboring samples and may be usedfor the intra prediction of the current block. Further, an X samplepositioned at the left upper corner of the current block may be used forthe intra prediction of the current block. In this case, the encoder mayperform the intra prediction in a vertical direction 410, a horizontaldirection 420, or a diagonal direction 430. Here, the number ofprediction direction and/or the prediction method, or the like, may bevariously defined.

Referring to FIG. 4, the encoder may perform the intra prediction in thevertical direction 410. In this case, the used neighboring sample may beone of A to H that are the upper neighboring samples. For example,p(0,0)=p(1,0)=p(2,0)=p(3,0)=p(4,0)=p(5,0)=p(6,0)=p(7,0)=A. Here, p(x, y)may represent the first prediction value for the sample of position (x,y) among the samples within the current block. In addition, A mayrepresent the sample values of A sample.

The encoder may also perform the intra prediction in the horizontaldirection 420. In this case, the used neighboring samples may be one ofI to P that are the left neighboring samples. For example,p(1,0)=p(1,1)=p(1,2)=p(1,3)=p(1,4)=p(1,5)=p(1,6)=p(1,7)=J. Here, J mayrepresent the sample value of J sample.

The encoder may also perform the intra prediction in the diagonaldirection 430. In this case, the encoder may perform the predictionusing at least one reconstructed neighboring samples. For example, whenthe intra prediction is performed using two neighboring samples, thefirst prediction value may be obtained by the weighting sum of the twosample values.

As the exemplary embodiment, p(3, 4) may be obtained by the followingEquation 1.p(3,4)=(8*G+24*H+16)>>5  [Equation 1]

Here, G may represent a sample value of a G sample and H may represent asample value of an H sample.

FIG. 5 is a flow chart schematically showing a method for deriving asecond prediction value in an encoder according to an exemplaryembodiment of the present invention.

Referring to FIG. 5, the encoder may determine the position of thereference sample within the current block (S510).

For example, the encoder may determine the predetermined fixed positionwithin the current block as the position of the reference sample. Inaddition, the encoder may determine a position at which the apredetermined cost function value is minimum as the position of thereference sample and the position of the reference sample using theinformation associated with the neighboring blocks adjacent to thecurrent block. The detailed exemplary embodiment of the method fordetermining the reference sample position will be described below.

Referring again to FIG. 5, the encoder may determine the value of thereference sample (S520). The detailed exemplary embodiment of the methodfor determining the reference sample value will be described below.

When the position of the reference sample and the value of the referencesample are determined, the encoder may decode and reconstruct thereference sample (S530).

The encoder obtains the prediction value of the reference sample andthen, the residual signal for the reference sample may be obtained bythe residuals of the sample value and the prediction value of thereference sample. The encoder may encode the residual signal andtransmit the encoded residual signal to the decoder. In addition, theencoder may reconstruct the reference sample from the encoded residualsignal to obtain the reconstructed reference sample. The detailedexemplary embodiment of the process of encoding and reconstructing thereference sample will be described below.

When the reconstructed reference sample is obtained, the encoder mayderive the second prediction value based on the reconstructed referencesample (S540). The detailed exemplary embodiment of the method forderiving the second prediction value using the reconstructed referencesample will be described below.

FIG. 6 is a conceptual diagram schematically showing a method forpositioning a reference sample according to an exemplary embodiment ofthe present invention.

The encoder may determine the predetermined fixed position within thecurrent block as the position of the reference sample. The position ofthe reference sample may be one or more. In this case, the decoder maydetermine the predetermined fixed position as the position of thereference sample and thus, the encoder may not transmit the informationon the position of the reference sample to the decoder. In addition,since the predetermined fixed position is used, the encoder may notperform the separate calculation for obtaining the position information.

The number of predetermined fixed positions and/or reference samples maybe differently defined according to the size of the current block and/orthe prediction mode of the current block.

Referring to reference numeral 610 of FIG. 6, when the size of thecurrent block is 8×8, the encoder may use one reference sample. In thiscase, the predetermined fixed position may be one. In addition, when thesize of the current block is 16×16, the encoder may use two referencesamples. In this case, the predetermined fixed position may be two. Whenthe size of the current block is 32×32, the encoder may use fourreference samples. In this case, the predetermined fixed position may befour. That is, the encoder may increase the number of reference samplesto be used as the size of the current block is increased.

Referring to reference numeral 620 of FIG. 6, the encoder may use aposition farthest away from the reconstructed neighboring samples usedfor the intra prediction as the predetermined fixed position accordingto the intra prediction mode and/or the prediction direction.

In the above-mentioned methods, the predetermined fixed position may bedefined as the position having the largest prediction errors throughtraining. As described above, the position having the largest predictionerror is determined as the position of the reference sample to reducethe prediction errors occurring at the time of the intra prediction.

Meanwhile, the encoder may also determine the position at which thevalue of the predetermined cost function is minimal as the position ofthe reference sample among the reference sample position candidateswithin the current block. For example, the encoder may calculate thecosts at the time of performing the intra prediction on each of thereference sample position candidates and may select the reference sampleposition candidates at which the calculated costs are minimal as thereference sample positions for the current block.

As the exemplary embodiment of the present invention, the predeterminedcost function may be a cost function based on a rate distortionoptimization (RDO) method. In this case, the encoder may calculate thecost function value by the following Equation 2.Cost=Distortion(pos)+lambda*Rate(pos)  [Equation 2]

Here, Cost may represent the cost function value and pos may representthe position of the reference sample. In addition, Distortion mayrepresent the distortion when the prediction is performed using thereference sample of the corresponding position pos and Rate mayrepresent a bit rate when the prediction is performed using thereference sample of the corresponding position pos. Lambda is a variableused for calculating the cost function value and the encoder may derivethe cost function value only by the Distortion when a lambda value is 0.

As another exemplary embodiment of the present invention, thepredetermined cost function may be a cost function based on sum ofabsolute difference (SAD). In this case, the encoder may calculate thecost function value by the following Equation 3.Cost=Σ|A−B(pos)|  [Equation 3]

Here, A may represent the original block and/or the reconstructed blockand B may represent the predicted block according to the position of thereference sample.

As another exemplary embodiment of the present invention, thepredetermined cost function may be the cost function based on sum ofabsolute transformed differences (SATD), sum of squared differences(SSD), or the like.

FIG. 7 is a conceptual diagram schematically showing a method forpositioning a reference sample according to another exemplary embodimentof the present invention. In the exemplary embodiment of the presentinvention of FIG. 7, a horizontal direction represents an x-axisdirection and a vertical direction represents a y-axis direction.

The encoder may determine the position of the reference sample by usingthe information associated with the neighboring blocks adjacent to thecurrent block.

As the exemplary embodiment of the present invention, referring toreference numeral 710 of FIG. 7, the encoder analyzes the value of thereconstructed neighboring sample 712 to determine the position of thereference sample within the current block 714. In this case, the encodermay determine the position of at least one reference sample based on thespatial variation of the neighboring sample value. Reference numeral 716of FIG. 7 may represent bodies and/or objects existing in a currentpicture. In this case, the difference between the sample values, thatis, the spatial variation may be large at the boundary between thebodies and/or the objects 716. Therefore, the difference of the samplevalue may be large between the samples present around the boundary ofthe bodies and/or the objects 716 among the reconstructed neighboringsamples 712.

For example, the encoder may obtain a point at which the difference inthe sample value between the samples adjacent to each other among theupper neighboring samples is above the predetermined threshold value.For example, the obtained point may be a point corresponding to theboundary of the bodies and/or the objects 716 within the currentpicture. Here, the x-axis directional coordinate of the obtained pointmay be referred to as an X. In addition, the encoder may obtain a pointat which the difference in the sample value between the samples adjacentto each other among the left neighboring samples is above thepredetermined threshold value. For example, the obtained point may be apoint corresponding to the boundary of the bodies and/or the objects 716within the current picture. Here, the y-axis directional coordinate ofthe obtained point may be referred to as a Y. In this case, the decodermay determine the (X, Y) point as the position of the reference sample.That is, the encoder may determine a point at which a vertical directionstraight line passing through the point obtained using the upperneighboring samples meets the horizontal direction straight line passingthrough a point obtained using the left neighboring samples as theposition of the reference sample.

As another exemplary embodiment of the present invention, the positionof the reference sample may determine using the encoding relatedinformation of the reconstructed neighboring blocks. Here, the decodingrelated information of the reconstructed neighboring blocks may includethe partition information, the prediction directional information, thequantization parameter information, or the like, of the neighboringblocks.

Referring to reference numeral 720 of FIG. 7, the encoder may search thepartition division point for the upper neighboring block. Here, thex-axis directional coordinate of the obtained point may be referred toas an X. In addition, the encoder may search the partition divisionpoint for the left neighboring block. Here, the y-axis directionalcoordinate of the obtained point may be referred to as a Y. In thiscase, the encoder may determine the (X, Y) point as the position of thereference sample. That is, the encoder may determine a point at which avertical direction straight passing through the division point for theupper neighboring blocks meets the horizontal direction straight passingthrough the division point for the left neighboring blocks as theposition of the reference sample.

Referring to reference numeral 730 of FIG. 7, the encoder may obtain thepoint at which the blocks having different prediction directions amongthe upper neighboring blocks are adjacent to one another. Here, thex-axis directional coordinate of the obtained point may be referred toas an X. In addition, the encoder may obtain the point at which theblocks having different prediction directions among the left neighboringblocks are adjacent to one another. Here, the y-axis directionalcoordinate of the obtained point may be referred to as a Y. In thiscase, the encoder may determine the (X, Y) point as the position of thereference sample. That is, the encoder may determine a point at which avertical direction straight passing through the obtained point for theupper neighboring blocks meets the horizontal direction straight passingthrough the obtained point for the left neighboring blocks as theposition of the reference sample.

When the position of the reference sample is determined by theabove-mentioned method, the encoder may encode the position of thedetermined reference sample and transmit the encoded reference sample tothe decoder.

FIG. 8 is a conceptual diagram schematically showing a method forencoding a reference sample position according to an exemplaryembodiment of the present invention.

The position of the reference sample may be represented by variousmethods. For example, the specific position within the current block maybe represented by the coordinate values that are the reference point.Referring to FIG. 8, the position of the reference point may be the sameas the sample 810 (HP) of the rightmost lower end within the currentblock. In this case, the position of the determined reference sample 820(EO) may be coordinate values (1, 3). Here, 1 may represent a positionmoved by 1 sample upwardly from the reference point and 3 may representa position moved by 3 samples in a left direction from the referencepoint. The method for defining the reference point and/or the coordinatevalues is not limited to the above-mentioned exemplary embodiment andtherefore, may be variously defined as an implementation manner and/oras needed.

When the coordinate values are determined, the determined coordinatevalues may be decoded. In this case, the encoder may transmit theencoded coordinate values to the decoder.

Meanwhile, as described above with reference to FIG. 5, the encoder maydetermine the sample value of the reference sample.

FIG. 9 is a conceptual diagram schematically showing a method fordetermining a reference sample value according to an exemplaryembodiment of the present invention. FIG. 9 shows the exemplaryembodiments of the case in which the size of the current block is 8×8.

As the exemplary embodiment of the present invention, the encoder maydetermine the sample value of the original sample existing at the sameposition as the position of the determined reference sample as thereference sample value for the current block. For example, in FIG. 9,when the position of the reference sample is as HP 910, the sample valueof the original sample existing at the HP position may be determined asthe sample value of the reference sample. Hereinafter, the originalsample existing at the same position as the reference sample positionmay be referred to as the co-position original sample.

As another exemplary embodiment of the present invention, the encodermay determine an average value of the sample value of the co-positionoriginal sample and the sample values of the original sample positionedaround the co-position original sample as the reference sample value forthe current block. Here, the original samples positioned around theco-position original sample may be the samples adjacent to theco-position original sample. Hereinafter, the original sample positionedaround the co-position original sample may be referred to as theneighboring original sample.

For example, in FIG. 9, when the position of the reference sample isdetermined as the HP 910, the average value of the co-position originalsample and the neighboring original sample may be calculated by thefollowing Equation 4.(GO+HO+GP+HP+2)>>2  [Equation 4]Here, the number and/or position of neighboring original samples may beset as the predetermined number and/or position and may be changedaccording to the prediction direction. For example, the value of thereference sample may be derived by the following Equation 5.(HO+FP+GP+HP+2)>>2  [Equation 5]or(GN+HN+FO+GO+HO+FP+GP+HP+4)>>3

When the position of the reference sample and the value of the referencesample are determined, the encoder may decode and reconstruct thereference sample.

FIG. 10 is a conceptual diagram for explaining a method for encoding areference sample according to the exemplary embodiment of the presentinvention.

The encoder may obtain the prediction value of the reference sample. Theprediction value of the reference sample may be referred to as theprediction reference sample. The prediction reference sample may be usedfor encoding the reference sample. Hereinafter, the exemplary embodimentof the method for deriving the prediction reference sample will bedescribed with reference to FIG. 10.

For example, the encoder may derive the sample value of the predictionreference sample by the average of the sample values of thereconstructed neighboring samples. This may be, for example, representedby the following Equation 6.Predicted(HP)=(TA+TB+TC+TD+TE+TF+TG+TH+LI+LJ+LK+LL+LM+LN+LO+LP+8)>>4  [Equation6]

Here, Predicted(x) may represent the prediction value of the referencesample positioned at x. In addition, T may represent the upperneighboring sample adjacent to the upper end of the current block and Lmay represent the left neighboring sample adjacent to the left of thecurrent block.

As another exemplary embodiment of the present invention, the encodermay derive the sample value of the prediction reference sample by theaverage of the sample having the same coordinates on the x axis as thereference sample among the reconstructed upper neighboring samples andthe sample value having the samples having the same coordinates on the yaxis as the reference sample among the reconstructed neighboringsamples. That is, the encoder may derive the sample value of theprediction reference sample by the average of the sample values of thesamples existing on the same vertical line as the reference sample amongthe reconstructed upper neighboring samples and the samples existing onthe same horizontal line as the reference sample among the reconstructedleft neighboring samples. When the position of the reference sample isHP, the sample value of the prediction reference sample may berepresented by the following Equation 7.Predicted(HP)=(TH+LP+1)>22 1  [Equation 7]

As another exemplary embodiment of the present invention, the encodermay select the predetermined fixed sample as the prediction value of thereference sample among the reconstructed neighboring samples. When thepredetermined fixed sample is TH, the prediction value of the referencesample may be calculated by the following Equation 8.Predicted(HP)=TH  [Equation 8]

When the predetermined fixed sample is LP, the prediction value of thereference sample may be calculated by the following Equation 9.Predicted(HP)=LP  [Equation 9]

As another exemplary embodiment of the present invention, when theplurality of reference samples is present for the current block, theencoder may derive the prediction value of the current reference sampleusing the previously encoded and reconstructed reference sample. Thismay be, for example, represented by the following Equation 10.Predicted(DL)=Reconstructed(HP)  [Equation 10]orPredicted(FN)=(Reconstructed(DL)+Reconstructed(HP)+1)>>1

Here, Reconstructed(x) may represent the sample value of the previouslyencoded and reconstructed reference sample positioned at x.

As another exemplary embodiment of the present invention, when theplurality of reference samples are present for the current block, theencoder may derive the prediction value of the current reference sampleusing the reconstructed left upper corner sample (X), the reconstructedneighboring sample, and/or the previously encoded and reconstructedreference sample. This may be, for example, represented by the followingEquation 11.Predicted(DL)=(X+Reconstructed(HP)+1)>>1  [Equation 11]Predicted(DL)=(X+TD+LL+Reconstructed(HP)+2)>>2

When the prediction reference sample is obtained by the above-mentionedmethod, the encoder may obtain the residual signal for the referencesample by the residuals of the sample value of the reference sample andthe sample value of the prediction reference sample. The method forderiving the residual signals may be, for example, represented by thefollowing Equation 12.Difference(HP)=Predicted(HP)−HP  [Equation 12]

Here, the HP may represent the sample value of the reference sample andthe Predicted (HP) may represent the sample value of the predictionreference sample. In addition, the Difference (HP) may represent theresidual signals.

The encoder may encode the derived residual signals. In this case, theencoder may directly encode the residual signals and may quantize thederived residual signals and then, encode the quantized residual signal.When the residual signal is quantized, the encoder may differently applythe step size according to the quantization parameter (QP).

In addition, when the plurality of reference samples is present for thecurrent block, the encoder may decode the plurality of reference blockstogether. For example, in FIG. 10, it is assumed that three referencesamples are present for the current block and the positions of thereference samples each are HP, FN, and DL. In this case, the encoder maytransform and encode the difference (HP), difference (FN), anddifference (DL) together. As another exemplary embodiment of the presentinvention, in FIG. 10, it is assumed that four reference samples arepresent for the current block and the positions of the reference sampleseach are DL, HL, DP, and HP. In this case, the encoder may transform andencode the difference (DL), the difference (HL), the difference (DP),and the difference (HP), together, by using the two-dimensionaltransform method such as a discrete cosine transform (DCT), or the like.The encoder may transmit the encoded residual signal to the decoder.

In addition, the encoder may reconstruct the reference sample from theencoded residual signal to obtain the reconstructed reference sample.The reconstructed reference sample may be used to derive the intraprediction and/or the second prediction value for the current block.

When the reconstructed reference sample is obtained by theabove-mentioned method, the encoder may derive the second predictionvalue based on the reconstructed reference sample.

FIG. 11 is a conceptual diagram schematically showing a method forderiving a second prediction value for a current block using areconstructed reference sample according to the exemplary embodiment ofthe present invention.

Reference numeral 1110 of FIG. 11 shows the exemplary embodiment of themethod for deriving the second prediction value when one reconstructedreference sample is present for the current block. Referring toreference numeral 1110 of FIG. 11, the sample value of the reconstructedreference value 1115 (HP) is 80. In this case, the second predictionvalue of all the samples existing in the current block may be 80.

Reference numeral 1120 of FIG. 11 shows another exemplary embodiment ofthe method for deriving the second prediction value when onereconstructed reference sample is present for the current block. Atreference numeral 1120 of FIG. 11, the prediction direction for thecurrent block is assumed to be the vertical direction 1126.

Referring to reference numeral 1120 of FIG. 11, the encoder may predictthe sample values within the current block by the weighting sum betweenthe sample value of the reconstructed neighboring sample and the samplevalue of the reconstructed reference sample. If the sample value of thelowest sample 1122 among the reconstructed left neighboring samples is20 and the sample value of the reconstructed reference sample 1124 is80, the sample value of the samples existing between the two values maybe predicted by the following Equation 13.second prediction value=(d*20+(8−d)*80+4)>>3  [Equation 13]

Herein, d may represent the weight value allocated to the reconstructedneighboring sample and may represent the sample unit distance from thereconstructed reference sample to the sample to be predicted. Inaddition, the size of the current block is 8×8 and the unit of theweight of 8 may be used. The method for performing the process of theweighting sum between the sample value of the reconstructed neighboringsamples and the sample value of the reconstructed reference sample isnot limited to the above method and the weighting sum process may beperformed in various methods as the implementation manner and/or asneeded.

Reference numeral 1130 of FIG. 11 shows the exemplary embodiment of themethod for deriving the second prediction value when two reconstructedreference samples are present for the current block. Referring to 1130of FIG. 11, the reconstructed referenced samples may each be CK(1132)and HP(1134). It is assumed that the sample value of the reconstructedreference sample (CK) 1132 is 35 and the sample value of thereconstructed reference sample (HP) 1134 is 80.

When the plurality of reconstructed reference samples is present for thecurrent block, the encoder may divide the current block into at leasttwo regions and derive the second prediction value for each dividedregion. In addition, for example, the divided region may determine theposition of the reconstructed reference sample as the reference.

For example, the encoder may divide the current block into the firstregion 1136 including the reconstructed reference sample (CK) 1132 andthe second region 1138 including the reconstructed reference sample (HP)1134. In this case, the second prediction value of the samples withinthe first region 1136 may be 35 that are equal to the sample value ofthe reconstructed reference sample (CK) 1132. In addition, the secondprediction value of the samples within the second region 1138 may be 80that are equal to the sample value of the reconstructed reference sample(HP) 1134.

As described above in FIG. 3, when the first prediction value and thesecond prediction value are derived, the encoder may derive the finalprediction value using the derived first prediction value and secondprediction value. In this case, the encoder may derive the finalprediction value for the samples within the current block by theweighting sum of the first prediction value and the second predictionvalue.

The method for deriving the final prediction value by the weighting summay be represented by the following Equation 14. In this case, theweighting value within the weighting matrix may be 0 or more and 1 orless.Final prediction value (x,y)={W(x,y)*second prediction value(x,y)+(1−W(x,y))*first prediction value (x,y)+1}>>1  [Equation 14]

Here, the final prediction value (x, y) may represent the finalprediction value for the samples of the position (x, y) within thecurrent block, the second prediction value (x, y) may represent thesecond prediction value for the sample of the position (x, y) within thecurrent block, and the first prediction value (x, y) may represent thefirst prediction value for the sample of the position (x, y) within thecurrent block. In addition, W(x, y) may represent the weighting valueexisting at the (x, y) position within the weighting matrix.

The weighting value within the weighting matrix may also be an integernumber of 1 or more. In this case, the method for deriving the finalprediction value by the weighting sum may be represented by thefollowing Equation 15.Final prediction value (x,y)={W(x,y)*second prediction value(x,y)+(32−W(x,y))*first prediction value (x,y)+16}>>5  [Equation 15]

In this case, the weighting sum process may be performed with theaccuracy of 1/32. The method for deriving the final prediction value bythe weighting sum is not limited to the exemplary embodiment of theabove-mentioned Equations 14 or 15 and the weighting sum process may bevariously performed according to the implementation manner and/or asneeded. For example, the weighting sum process may also be performedwith the accuracy of ⅛, 1/16, or 1/64, or the like.

FIG. 12 is a conceptual diagram schematically showing a weighting matrixaccording to the exemplary embodiment of the present invention.

Reference numeral 1210 of FIG. 12, the size of the current blockrepresents the exemplary embodiment of the weighting matrix of the casein which the size of the current block is 16×16 and reference numerals1220 and 1230 of FIG. 12 show the exemplary embodiment of the weightingmatrix of the case in which the size of the current block is 8×8. Arrowswithin each matrix represent the prediction direction for the currentblock.

Referring to FIG. 12, the encoder may differently determine theweighting matrix according to the size of the current block and/or theprediction direction for the current block, or the like. In this case,the initial weighting matrix may be determined through the training. Forexample, the encoder allocates the large weighting value to the secondprediction value as the distance from the reconstructed neighboringsamples used for the intra prediction is increased, thereby reducing theprediction errors.

In addition, as the exemplary embodiment of the present invention, theencoder may use the predetermined fixed weighting matrix according tothe size of the current block and/or the prediction direction. Theinformation on the predetermined fixed weighting matrix may be similarlystored in the decoder. In this case, the decoder can infer theinformation on the weighting matrix used in the encoder without theseparate additional information and therefore, the encoder may nottransmit the information on the weighting matrix to the decoder.

As another exemplary embodiment of the present invention, the encodermay adaptively update the weight matrix during the process of performingthe intra prediction. For example, the encoder may generate the weightmatrix set and then, select the optimal weight matrix within thegenerated weight matrix set. In addition, the encoder may adaptivelyupdate the weight values within the weight matrix. When the weightmatrix is selected, the encoder may derive the final prediction valueusing the selected weight matrix. In this case, the encoder may encodethe additional information identifying and/or indicating whether anyweight matrix is selected in the weight matrix set and may the encodedadditional information to the decoder.

According to the intra prediction method described in FIGS. 3 to 12, theprediction error may be reduced and the accuracy of the intra predictioncan be improved, through the weighting sum of the first prediction valueand the second prediction value. Therefore, the encoding efficiency canbe improved.

FIG. 13 is a flow chart schematically showing an intra prediction methodin a decoder according to an exemplary embodiment of the presentinvention.

Referring to FIG. 13, the decoder may derive the first prediction valuefor the current block (S1310). In this case, the decoder may derive thefirst prediction value by the same method as in the encoder. Thedetailed exemplary embodiment of the method for deriving the firstprediction value is described above and therefore, the descriptionthereof will be omitted.

In addition, the decoder may derive the second prediction value usingthe reference sample within the current block (S1320). The decoder maydetermine the position of the reference sample and may reconstruct thereference sample of the determined position. When the reference sampleis reconstructed, the decoder may derive the second prediction valueusing the reconstructed reference sample. The detailed exemplaryembodiment of the method for deriving the second prediction value willbe described in FIG. 14.

Herein, the process of deriving the first prediction value and theprocess of deriving the second prediction value may be performed insequence different from the above-mentioned description orsimultaneously. For example, the decoder may derive the secondprediction value earlier than the first prediction value and the processof deriving the first prediction value and the process of deriving thesecond prediction value may be simultaneously performed.

When the first prediction value and the second prediction value arederived, the decoder may derive the final prediction value using thederived first prediction value and second prediction value (S1330).

For example, the decoder may derive the final prediction value for thesamples within the current block by the weighting sum of the firstprediction value and the second prediction value. In this case, thedecoder may derive the final prediction value by the same method as inthe encoder and may use the weighting matrix for calculating theweighting sum of the first prediction value and the second predictionvalue.

As the exemplary embodiment of the present invention, the decoder mayuse the predetermined fixed weighting matrix. In this case, theinformation on the predetermined fixed weighting matrix may be similarlystored in the encoder and the decoder. Therefore, the decoder may usethe same weighting matrix as one used in the encoder without theseparate additional information.

As another exemplary embodiment of the present invention, the decodermay adaptively update the weight matrix during the process of performingthe intra prediction. For example, the decoder may generate the weightmatrix set and then, select the optimal weight matrix within thegenerated weight matrix set. In addition, the decoder may adaptivelyupdate the weight values within the weight matrix. When the weightmatrix is selected, the decoder may derive the final prediction valueusing the selected weight matrix.

As described above in FIG. 12, when the encoder adaptively uses theweighting matrix, the encoder may encode the additional informationassociated with the update of the weighting matrix and may the encodedadditional information to the decoder. For example, the additionalinformation may include the identifier, or the like, indicating whetherany weighting matrix is selected in the weighting matrix set. In thiscase, the decoder may receive and decode the additional information andmay use the decoded additional information in the update of theweighting matrix.

FIG. 14 is a flow chart schematically showing a method for deriving asecond prediction value in the decoder according to an exemplaryembodiment of the present invention.

Referring to FIG. 14, the decoder may determine the position of thereference sample (S1410).

For example, the decoder may determine the predetermined fixed positionwithin the current block as the position of the reference sample. Inthis case, the information on the predetermined fixed position may besimilarly stored in the encoder and the decoder. Therefore, the decodermay determine the position of the reference sample similar to theencoder without the separate additional information. The detailedexemplary embodiment of the method for determining the predeterminedfixed position as the position of the reference sample is described inFIG. 6 and therefore, the detailed description thereof will be omitted.

As another exemplary embodiment of the present invention, the decodermay determine the position of the reference sample using the informationon the position of the reference sample received from the encoder. Asdescribed above in FIG. 8, the encoder may encode the information on theposition of the reference sample and may transmit the encodedinformation to the decoder. In this case, the decoder may parse and/ordecode the information on the position of the reference sample from thebitstream and may determine the position of the reference sample byusing the parsed and/or decoded information.

As another exemplary embodiment of the present invention, the decodermay also determine the position of the reference sample by using theinformation associated with the neighboring blocks adjacent to thecurrent block. In this case, the decoder may determine the position ofthe reference sample by the same method as in the encoder. The detailedexemplary embodiment of the method for determining the reference sampleusing the neighboring block related information may be described abovein FIG. 7 and the detailed description thereof will be omitted.

Referring again to FIG. 14, the decoder may reconstruct the referencesample of the determined position (S1420).

As described above, the encoder obtains the prediction value of thereference sample and then, the residual signal for the reference samplemay be obtained by the residuals of the sample value and the predictionvalue of the reference sample. The encoder may encode the residualsignal and transmit the encoded residual signal to the decoder. In thiscase, the decoder may parse and/or decode the residual signals from thebitstream and may reconstruct the reference sample using the parsedand/or decoded residual signals.

The encoder may obtain the prediction value of the reference sample. Inthis case, the decoder may derive the prediction value by the samemethod as in the encoder. The sample values of the reconstructedneighboring samples and/or the previously reconstructed referencesample, or the like, may be used for driving the prediction value of thereference sample. When the prediction value of the reference sample isderived, the decoder adds the parsed residual signal and the predictionvalue of the derived reference sample to generate the reconstructedreference sample. The detailed exemplary embodiment of the method forderiving the reference sample prediction value is described above inFIG. 10 and therefore, the detailed description thereof will be omitted.

When the reconstructed reference sample is obtained, the decoder mayderive the second prediction value using the reconstructed referencesample (S1430). In this case, the decoder may derive the secondprediction value by the same method as in the encoder. The detailedexemplary embodiment of the method for deriving the second predictionvalue using the reconstructed reference sample is described above inFIG. 11 and therefore, the detailed description thereof will be omitted.

According to the intra prediction method described in FIGS. 13 and 14,the prediction error may be reduced and the accuracy of the intraprediction can be improved, through the weighting sum of the firstprediction value and the second prediction value. Therefore, thedecoding efficiency can be improved.

In the above-mentioned exemplary system, although the methods havedescribed based on a flow chart as a series of steps or blocks, thepresent invention is not limited to a sequence of steps but any step maybe generated in a different sequence or simultaneously from or withother steps as described above. Further, it may be appreciated by thoseskilled in the art that steps shown in a flow chart is non-exclusive andtherefore, include other steps or deletes one or more steps of a flowchart without having an effect on the scope of the present invention.

The above-mentioned embodiments include examples of various aspects.Although all possible combinations showing various aspects are notdescribed, it may be appreciated by those skilled in the art that othercombinations may be made. Therefore, the present invention should beconstrued as including all other substitutions, alterations andmodifications belong to the following claims.

The invention claimed is:
 1. An image decoding method performed by animage decoding apparatus, comprising: deriving a first prediction valuefor a current block by performing prediction using, as a first referencesample, at least one of neighboring samples adjacent to the currentblock; deriving a second prediction value for the current block byusing, as a second reference sample, at least one of a reference samplepositioned in the current block and a left upper corner sample at a leftupper corner of the current block; and deriving a final prediction valuefor the current block by using values obtained by applying a firstweight to the first prediction value and applying a second weight to thesecond prediction value, wherein the first weight and the second weightare determined based on an intra prediction mode of the current block.2. The method of claim 1, wherein the deriving of the second predictionvalue further comprises: determining a position of the second referencesample; reconstructing the second reference sample of the determinedposition; and deriving the second prediction value using thereconstructed second reference sample.
 3. The method of claim 2, whereinthe determining the position of the second reference sample determines apredetermined fixed position as the position of the second referencesample.
 4. The method of claim 2, wherein the positioning of the secondreference sample further comprises: receiving position information onthe position of the second reference sample from an bitstream; decodingthe position information; and determining a position of the secondreference sample using the decoded position information.
 5. The methodof claim 2, wherein the determining the position of the second referencesample determines the position of the second reference sample usingneighboring block information included in one or more reconstructedneighboring blocks, the one or more reconstructed neighboring blocksbeing blocks adjacent to the current block and the neighboring blockinformation being at least one of partition information, predictiondirection information, and quantization parameter information of thereconstructed neighboring blocks.
 6. An image encoding method performedby an image encoding apparatus, comprising: deriving a first predictionvalue for a current block by performing prediction using, as a firstreference sample, at least one of neighboring samples adjacent to thecurrent block; deriving a second prediction value for the current blockby using, as a second reference sample, at least one of a referencesample positioned in the current block and a left upper corner sample ata left upper corner of the current block; and deriving a finalprediction value for the current block by using values obtained byapplying a first weight to the first prediction value and applying asecond weight to the second prediction value, wherein the first weightand the second weight are determined based on an intra prediction modeof the current block.
 7. A non-transitory computer-readable mediumstoring a bitstream which is received and decoded by an image decodingapparatus and used to reconstruct an image, comprising: deriving a firstprediction value for a current block by performing prediction using, asa first reference sample, at least one of neighboring samples adjacentto the current block; deriving a second prediction value for the currentblock by using, as a second reference sample, at least one of areference sample positioned in the current block and a left upper cornersample at a left upper corner of the current block; and deriving a finalprediction value for the current block by using values obtained byapplying a first weight to the first prediction value and applying asecond weight to the second prediction value, wherein the first weightand the second weight are determined based on an intra prediction modeof the current block.
 8. An image decoding method performed by an imagedecoding apparatus, comprising: deriving a first prediction value byusing two neighboring samples adjacent to a current block; deriving asecond prediction value by deriving a reference sample value of areference sample at a predetermined position inside the current block;and generating a prediction block of the current block by weightedsumming a sample value of neighboring samples adjacent to the currentblock and the second prediction value, wherein the two neighboringsamples used for deriving the first prediction value are adjacent toeach other.
 9. The image decoding method of claim 8, wherein the firstprediction value is derived as a weighted sum of the two neighboringsamples adjacent to each other.